/* AgeLabel.java 
* Created on Dec 19, 2012 
* Author:Mr.Viet
* Phone: 01683430426
* Email: phamvanvietcdhd@gmail.com
*/ 
package com.session5; 

import java.awt.Color;
import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

public class AgeLabel implements TableCellRenderer {

	@Override
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		JLabel lblAge = new JLabel(value.toString());
		int age = Integer.parseInt(value.toString());
		if(age<20) lblAge.setForeground(Color.blue);
		else lblAge.setForeground(Color.red);
		return lblAge;
	}

}
